<?php

use Symfony\Component\Form\AbstractType;

use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\MinLength;
use Symfony\Component\Validator\Constraints\Collection;

class ContactType extends AbstractType 
{
  function getDefaultOptions($options) 
  {
  	$collectionConstraint = new Collection(array(
  	   'name' => new MinLength(5),
  	   'email' => new Email(array('message' => 'Invalid email address'))
  	));
  	
  	$options['validation_constraint'] = $collectionConstraint;
  }
  
}